/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import domain.Map;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 *
 * @author Teddy
 */
public class MainFrame extends JFrame {

    private MapPanel _mapPanel;
    private JTextArea _textArea;
    private Map _map;

    public MainFrame(Map map) {
        super("Websom");
        this._map = map;
        getContentPane().setPreferredSize(new Dimension(700,600));
        init();
        pack();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    private void init() {
        _mapPanel = new MapPanel(_map,this);
        _textArea = new JTextArea();
        JScrollPane scrollPane = new JScrollPane(_textArea);
        scrollPane.setPreferredSize(new Dimension(0, 200));
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(_mapPanel,BorderLayout.CENTER);
        getContentPane().add(scrollPane,BorderLayout.SOUTH);
    }

    public void showText(String text){
        this._textArea.setText(text);
    }
}
